<template>
  <div class="mylist">
    <ul>
      <li
        class="tanxin"
        v-for="(item, index) in list"
        :key="index"
        @click="cllfn(item.id)"
      >
        <img :src="item.coverImgUrl" alt="" />
        <div>
          <h3 class="ellipsis">{{ item.name }}</h3>
          <p class="ellipsis">
            {{ item.trackCount }}首 by{{ item.creator.nickname }}
          </p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import { Getursegedanxq } from "@/request/api";
export default {
  props: ["list"],
  data() {
    return {};
  },
  methods: {
    cllfn(id) {
      Getursegedanxq({ id }).then((res) => {
        if (res.data.code) {
          this.$store.commit("Channegedanxq", res.data.playlist);
        }
      });
    },
  },
};
</script>
 
<style lang = "less" scoped>
@import "@/assets/base.less";
.mylist {
  width: 240px;
  orphans: 20px;
  box-sizing: border-box;
  ul {
    li {
      width: 240px;
      height: 54px;
      justify-content: flex-start;
      img {
        width: 40px;
        height: 40px;
        margin-left: 20px;
        margin-top: 7px;
      }
      div {
        margin-top: 7px;
        margin-left: 10px;
        h3 {
          font-weight: 400;
          font-size: 14px;
          width: 150px;
        }
        p {
          width: 140px;
          font-size: 12px;
          color: #ccc;
        }
      }
    }
  }
}
</style>